import loadingComponentoption from './Loading.vue'

const $loading = {
  install (Vue) {
    // 定义组件的类
    const LoadingClass = Vue.extend(loadingComponentoption)
    // 得到组件的实例
    const loadingComponent = new LoadingClass()

    // 将组件插入到html结构中
    const loadingTpl = loadingComponent.$mount().$el
    document.body.appendChild(loadingTpl)
    Vue.prototype.$showLoading = () => {
      loadingComponent.isShow = true
    }
    Vue.prototype.$closeLoading = () => {
      loadingComponent.isShow = false
      console.log('close')
    }
  }
}
export default $loading
